<template>
	<view class="center">
		<view class="order" v-for="(item,index) in rammend1" :key="index" v-slot="scope">
			<u-table class="orderc" padding="10px 10px">
				<u-tr>
					<u-th>快递员联系电话</u-th>
					<u-th>快递</u-th>
					<u-th>发布时间</u-th>
					<u-th>是否完成</u-th>
				</u-tr>
				<u-tr>
					<u-td>{{item.orderuser_phone}}</u-td>
					<u-td>{{item.type}}</u-td>
					<u-td>{{item.create_time}}</u-td>
					<u-td><u-button size="mini" type='primary' @click="done(item._id)">完成</u-button></u-td>
				</u-tr>
			</u-table>
			<u-line color="#e4e7ed" />
		</view>
		<view class="tites">
		<u-empty text="没有更多" mode="order" icon-size="50rpx"></u-empty>
		<button @click="text"></button>
		</view>
	</view>
</template>

<script>
	export default {
	data(){
		return{
			rammend1:[]
		}
	},
	mounted(){
			this.getorderlist()
	},
	methods:{
		done(_id){
			
			const db = uniCloud.database();
			let collection = db.collection("uni-id-base-order")
			let res = collection.where({_id:_id})
			  .update({
			   status:3,
			  }).then((res) => {
			        uni.showToast({
			            title: '已收货'
			        })
			    })
			
			
		},
		getorderlist(){
			const db = uniCloud.database() //代码块为cdb
			// 使用uni-clientDB
			db.collection('uni-id-base-order')
			  .where(
					'user_id == $cloudEnv_uid && status!=3'
			  ).get()
			  .then((res)=>{
			   this.rammend1=res.result.data
			   console.log(res)
			  })
		},
	}
	}
</script>

<style>
</style>
